package com.springcloud.log.modular.log.controller;

import com.springcloud.commom.annotion.BusinessLog;
import com.springcloud.commom.api.R;
import com.springcloud.commom.enums.LogAnnotionOpTypeEnum;
import com.springcloud.log.modular.log.service.SysVisLogService;
import com.springcloud.log.param.SysVisLogParam;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 系统访问日志表控制器
 *
 * @author hzl
 * @date 2024-07-24 15:35:36
 */
@RestController
public class SysVisLogController {

    @Resource
    private SysVisLogService sysVisLogService;

    /**
     * 查询系统访问日志表
     *
     * @author hzl
     * @date 2024-07-24 15:35:36
     */
    @GetMapping("/sysVisLog/page")
    @BusinessLog(title = "系统访问日志表_查询", opType = LogAnnotionOpTypeEnum.QUERY)
    public R page(SysVisLogParam sysVisLogParam) {
        return R.data(sysVisLogService.page(sysVisLogParam));
    }

    /**
     * 添加系统访问日志表
     *
     * @author hzl
     * @date 2024-07-24 15:35:36
     */
    @PostMapping("/sysVisLog/add")
    @BusinessLog(title = "系统访问日志表_增加", opType = LogAnnotionOpTypeEnum.ADD)
    public R add(@RequestBody @Validated(SysVisLogParam.add.class) SysVisLogParam sysVisLogParam) {
            sysVisLogService.add(sysVisLogParam);
        return R.success();
    }

    /**
     * 删除系统访问日志表
     *
     * @author hzl
     * @date 2024-07-24 15:35:36
     */
    @PostMapping("/sysVisLog/delete")
    @BusinessLog(title = "系统访问日志表_删除", opType = LogAnnotionOpTypeEnum.DELETE)
    public R delete(@RequestBody @Validated(SysVisLogParam.delete.class) SysVisLogParam sysVisLogParam) {
            sysVisLogService.delete(sysVisLogParam);
        return R.success();
    }

    /**
     * 编辑系统访问日志表
     *
     * @author hzl
     * @date 2024-07-24 15:35:36
     */
    @PostMapping("/sysVisLog/edit")
    @BusinessLog(title = "系统访问日志表_编辑", opType = LogAnnotionOpTypeEnum.EDIT)
    public R edit(@RequestBody @Validated(SysVisLogParam.edit.class) SysVisLogParam sysVisLogParam) {
            sysVisLogService.edit(sysVisLogParam);
        return R.success();
    }

    /**
     * 查看系统访问日志表
     *
     * @author hzl
     * @date 2024-07-24 15:35:36
     */
    @GetMapping("/sysVisLog/detail")
    @BusinessLog(title = "系统访问日志表_查看", opType = LogAnnotionOpTypeEnum.DETAIL)
    public R detail(@Validated(SysVisLogParam.detail.class) SysVisLogParam sysVisLogParam) {
        return R.data(sysVisLogService.detail(sysVisLogParam));
    }

    /**
     * 系统访问日志表列表
     *
     * @author hzl
     * @date 2024-07-24 15:35:36
     */
    @GetMapping("/sysVisLog/list")
    @BusinessLog(title = "系统访问日志表_列表", opType = LogAnnotionOpTypeEnum.QUERY)
    public R list(SysVisLogParam sysVisLogParam) {
        return R.data(sysVisLogService.list(sysVisLogParam));
    }

}
